#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e4+1;
int n;
int a[N],b[N];
bool cheekmin(ll x)
{
	for(int i = 0;i<n;i++)
	{
		if(a[i]/x>b[i])
		return false;
	}
	return true;
}
bool cheekmax(ll x)
{
	for(int i = 0;i<n;i++)
	{
		if(a[i]/x<b[i])
		return false;
	}
	return true;
}
int main()
{
	//int n;
	cin>>n;
	ll V = 1e9;
	//int a[N],b[N];
	ll v_min,v_max;
	for(int i = 0;i<n;i++)
	{
		cin>>a[i]>>b[i];
	}
	int L = 1,R = V;
	while(L<=R)
	{
		ll mid = (L+R)/2;
		if(cheekmin(mid))
		{
			v_min = mid;
			R = mid - 1;
		}
		else{
			L = mid+1;
		}
	}
	L = 1,R = V;
	while(L<=R)
	{
		ll mid = (L+R)/2;
		if(cheekmax(mid))
		{
			v_max = mid;
			L = mid + 1;
		}
		else{
			R = mid-1;
		}
	}
	cout<<v_min<<' '<<v_max<<endl;
}
